<?php

include_once("connexion.php");

$_SESSION['url'] = 'detail_location.php?id='.$_GET["id"];
if (!isset($_SESSION["userId"])){
	header("location:authentification.php");
}


if(isset($_GET['id'])){
	$id = $_GET['id']; 

$_SESSION['id_traitement'] = $id;	
	
	
$query = "SELECT type.type, logement.surface, ville.ville, logement.debut_baille, fin_baille 
		  FROM logement, type, ville 
		  WHERE logement.id = '".$id."' AND type.id = logement.id_type AND ville.id = logement.id_ville ";
	$resultat = mysqli_query($connexion, $query);


$query2 = "SELECT logement.description FROM logement WHERE logement.id ='".$id."'";
	$resultat2 = mysqli_query($connexion, $query2);


$query3 = "SELECT type.type, user.login, ville.ville, pays.pays, logement.surface, logement.piece, logement.adresse, logement.tarif_semaine, logement.tarif_journee, logement.debut_baille, logement.fin_baille, ville.code_postal     
		   FROM logement, type, ville, pays, user 
		   WHERE logement.id = '".$id."' AND type.id = logement.id_type AND ville.id = logement.id_ville AND pays.id = ville.id_pays AND user.id = logement.id_bailleur";
	$resultat3 = mysqli_query($connexion, $query3);


$query4 = "SELECT location.debut_location, location.fin_location
		   FROM location
		   WHERE location.id_logement = '".$id."'
		   ORDER BY location.debut_location";
	$resultat4 = mysqli_query($connexion, $query4);
}



include_once("banniere.html");

include_once("detail_location.html");

include_once("footer.html");


?>